# coding=utf8

# Copyright 2018 JDCLOUD.COM
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# NOTE: This class is auto generated by the jdcloud code generator program.

from jdcloud_sdk.core.jdcloudrequest import JDCloudRequest


class GeneralCreateTriggerRequest(JDCloudRequest):
    """
    生成创建触发器SQL语句，支持Mysql
    """

    def __init__(self, parameters, header=None, version="v1"):
        super(GeneralCreateTriggerRequest, self).__init__(
            '/regions/{regionId}/trigger:generalCreate', 'POST', header, version)
        self.parameters = parameters


class GeneralCreateTriggerParameters(object):

    def __init__(self,regionId, ):
        """
        :param regionId: 地域代码，取值范围参见[《各地域及可用区对照表》](../Enum-Definitions/Regions-AZ.md)
        """

        self.regionId = regionId
        self.dataSourceId = None
        self.dbName = None
        self.triggerName = None
        self.triggerTiming = None
        self.triggerEvent = None
        self.triggerTable = None
        self.triggerStatement = None

    def setDataSourceId(self, dataSourceId):
        """
        :param dataSourceId: (Optional) 数据源id。
        """
        self.dataSourceId = dataSourceId

    def setDbName(self, dbName):
        """
        :param dbName: (Optional) 数据库名称。
        """
        self.dbName = dbName

    def setTriggerName(self, triggerName):
        """
        :param triggerName: (Optional) 触发器名称。
        """
        self.triggerName = triggerName

    def setTriggerTiming(self, triggerTiming):
        """
        :param triggerTiming: (Optional) 触发时机，BEFORE("BEFORE", 1),AFTER("AFTER", 2)。
        """
        self.triggerTiming = triggerTiming

    def setTriggerEvent(self, triggerEvent):
        """
        :param triggerEvent: (Optional) 激活触发器的事件，INSERT("INSERT", 1),UPDATE("UPDATE", 2), DELETE("DELETE", 3)。
        """
        self.triggerEvent = triggerEvent

    def setTriggerTable(self, triggerTable):
        """
        :param triggerTable: (Optional) 触发表。
        """
        self.triggerTable = triggerTable

    def setTriggerStatement(self, triggerStatement):
        """
        :param triggerStatement: (Optional) 触发器定义。
        """
        self.triggerStatement = triggerStatement

